import org.junit.Assert;
import org.junit.Test;


public class TestBackend {

	@Test
	public void testMain() throws Exception
	{
		String args [] = new String[0];
		boolean exception = false;
		
		try
		{
		Backend.main(args);
		}
		catch (Exception ex)
		{
			exception = true;
		}
		
		Assert.assertFalse (exception);
	}
	
	@Test
	public void testMainArguments() throws Exception
	{
		String args [] = new String [4];
		boolean exception = false;
		
		// our actual method does not use arguments yet
		// that would be useful for testing purposes
		// which you will see when you see why the exception 
		// is thrown
		args [0] = "tests\\testTransaction.out";
		args [1] = "tests\\testMaster.in";
		args [2] = "tests\\testMaster.out";
		args [3] = "tests\\testCurrent.in";
		
		try
		{
		Backend.main(args);
		}
		catch (Exception ex)
		{
			exception = true;
		}
		
		Assert.assertFalse (exception);
		
	}
	
	@Test
	public void testMainTitleDoesNotExist() throws Exception
	{
		String args [] = new String [4];
		boolean exception = false;
		
		// our actual method does not use arguments yet
		// that would be useful for testing purposes
		// which you will see when you see why the exception 
		// is thrown
		args [0] = "tests\\testTransactionTitleDoesNotExist.out";
		args [1] = "tests\\testMaster.in";
		args [2] = "tests\\testMaster.out";
		args [3] = "tests\\testCurrent.in";
		
		try
		{
		Backend.main(args);
		}
		catch (Exception ex)
		{
			exception = true;
		}
		
		Assert.assertFalse (exception);
		
	}
	
	@Test
	public void testMainAboveQuantity() throws Exception
	{
		String args [] = new String [4];
		boolean exception = false;
		
		// our actual method does not use arguments yet
		// that would be useful for testing purposes
		// which you will see when you see why the exception 
		// is thrown
		args [0] = "tests\\testTransactionAboveQuantity.out";
		args [1] = "tests\\testMaster.in";
		args [2] = "tests\\testMaster.out";
		args [3] = "tests\\testCurrent.in";
		
		try
		{
		Backend.main(args);
		}
		catch (Exception ex)
		{
			exception = true;
		}
		
		Assert.assertFalse (exception);
		
	}
	
	@Test
	public void testMainEmpty() throws Exception
	{
		String args [] = new String [4];
		boolean exception = false;
		
		// our actual method does not use arguments yet
		// that would be useful for testing purposes
		// which you will see when you see why the exception 
		// is thrown
		args [0] = "tests\\testTransactionEmpty.out";
		args [1] = "tests\\testMaster.in";
		args [2] = "tests\\testMaster.out";
		args [3] = "tests\\testCurrent.in";
		
		try
		{
		Backend.main(args);
		}
		catch (Exception ex)
		{
			exception = true;
		}
		
		Assert.assertFalse (exception);
		
	}
	
}
